﻿using Data;
using Data.Impl;
using EF.Caching;
using EF.Caching.Impl;
using Microsoft.Practices.Unity;
using Service;
using Service.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace DI.Impl
{
    public class DiConfig : DiConfigBase
    {
        protected override IUnityContainer CreateContainer()
        {
            var container = new UnityContainer();

            #region Transverse & Framework
            container.RegisterType<IPerRequestCache, HttpContextItemsCache>(getSingleton());
            #endregion

            #region Services
            container.RegisterType<IAppInitializer, AppInitializer>(getSingleton());
            container.RegisterType<IUserManager, UserManager>(getSingleton());
            container.RegisterType<IContactUsManager, ContactUsManager>(getSingleton());
            container.RegisterType<IArticleManager, ArticleManager>(getSingleton());
            container.RegisterType<IImageManager, ImageManager>(getSingleton());
            container.RegisterType<IArticleImageManager, ArticleImageManager>(getSingleton());
            container.RegisterType<IMailService, MailService>(getSingleton());
            container.RegisterType<IJobOfferManager, JobOfferManager>(getSingleton());
            
            #endregion

            #region Data
            container.RegisterType<IDataTierInitializer, Initializer>(getSingleton());
            container.RegisterType<SessionManager, SessionManager>(getSingleton());
            container.RegisterType<ISchemaExporter, SchemaExporter>(getSingleton());
            container.RegisterType<IGenericRepository, GenericRepository>(getSingleton());
            #endregion

            return container;
        }
    }
}
